package com.qd.common.panda.domain.entity.card;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 卡卷明细
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class CardInfoDetailDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "卡卷明细";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "卡卷ID"})
    @NotBlank(message = "卡卷ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "卡卷ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String cardId;
    /**
     * 用户手机号
     */
    @ExcelProperty(value = {EXCEL_TITLE,"用户手机号"})
    @Size(max = 20, message = "用户手机号长度不能超过{max}位", groups = DefaultGroup.class)
    private String mobile;
    /**
     * 兑换时间
     */
    @ExcelProperty(value = {EXCEL_TITLE,"兑换时间"})
    private LocalDateTime redemptionTime;
    /**
     * 使用时间
     */
    @ExcelProperty(value = {EXCEL_TITLE,"使用时间"})
    private LocalDateTime useTime;
    /**
     * 卷有效期
     */
    @ExcelProperty(value = {EXCEL_TITLE,"卷有效期"})
    private LocalDate validityEndTime;
    /**
     * 兑换码
     */
    @ExcelProperty(value = {EXCEL_TITLE,"兑换码"})
    @NotBlank(message = "兑换码不能为空", groups = DefaultGroup.class)
    @Size(max = 16, message = "兑换码长度不能超过{max}位", groups = DefaultGroup.class)
    private String redeemCode;
    /**
     * 状态:0未兑换1已兑换2已使用3已过期
     */
    @ExcelProperty(value = {EXCEL_TITLE,"状态:0未兑换1已兑换2已使用3已过期"})
    @NotNull(message = "状态:0未兑换1已兑换2已使用3已过期不能为空", groups = DefaultGroup.class)
    private Integer useState;
    /**
     * 用户ID
     */
    @ExcelProperty(value = {EXCEL_TITLE,"用户ID"})
    @Size(max = 50, message = "用户ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String userId;
    /**
     * 卷信息
     */
    @ExcelProperty(value = {EXCEL_TITLE,"卷信息"})
    @NotBlank(message = "卷信息不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "卷信息长度不能超过{max}位", groups = DefaultGroup.class)
    private String cardMsgId;
    /**
     * 计划ID
     */
    @ExcelProperty(value = {EXCEL_TITLE,"计划ID"})
    @NotBlank(message = "计划ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "计划ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String planId;

    @Override
    public void freeData() {
        this.cardId = null;
        this.mobile = null;
        this.redemptionTime = null;
        this.useTime = null;
        this.validityEndTime = null;
        this.redeemCode = null;
        this.useState = null;
        this.userId = null;
        this.cardMsgId = null;
        this.planId = null;
        super.freeData();
    }
}
